<?php
/**
 * Class descript.
 * User: 广州利大科技 chan
 * Date: 2017/8/7 20:19
 */

namespace app\api\controller;

use app\api\service\AliPay;
use \app\api\service\Pay as PayService;
use app\api\service\WxPay;
use think\Request;

class Pay extends Base
{
    private  $payService;
    //检查权限作用域
    protected $beforeActionList  = [
        'checkPrimaryScope' => [
            'only' => 'WxAppPay,WxPay,AliPay'
        ],
    ];
    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->payService =  new PayService();
    }


    public function WxAppPay()
    {
        $data = object_to_array(json_decode($this->payService->WxAppPay()));
        return  $this->ajaxReturn($data) ;
    }

    public function WxPayNotice(){
        return  json((new WxPay())->notify()) ;
    }
    public function AliPay()
    {
        return $this->ajaxReturn($this->payService->AliPay());
    }
    public function AliPayNotice()
    {
        return  json((new AliPay())->notify()) ;
    }




}